//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CBitSet {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CBitSet(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CBitSet obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CBitSet(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CBitSet() {
    this(nelmiscJNI.new_CBitSet__SWIG_0(), true);
  }

  public CBitSet(long numBits) {
    this(nelmiscJNI.new_CBitSet__SWIG_1(numBits), true);
  }

  public CBitSet(CBitSet bs) {
    this(nelmiscJNI.new_CBitSet__SWIG_2(CBitSet.getCPtr(bs), bs), true);
  }

  public CBitSet assign(CBitSet bs) {
    return new CBitSet(nelmiscJNI.CBitSet_assign(swigCPtr, this, CBitSet.getCPtr(bs), bs), false);
  }

  public void resize(long numBits) {
    nelmiscJNI.CBitSet_resize(swigCPtr, this, numBits);
  }

  public void resizeNoReset(long numBits, boolean value) {
    nelmiscJNI.CBitSet_resizeNoReset__SWIG_0(swigCPtr, this, numBits, value);
  }

  public void resizeNoReset(long numBits) {
    nelmiscJNI.CBitSet_resizeNoReset__SWIG_1(swigCPtr, this, numBits);
  }

  public void clear() {
    nelmiscJNI.CBitSet_clear__SWIG_0(swigCPtr, this);
  }

  public long size() {
    return nelmiscJNI.CBitSet_size(swigCPtr, this);
  }

  public void set(int bitNumber, boolean value) {
    nelmiscJNI.CBitSet_set__SWIG_0(swigCPtr, this, bitNumber, value);
  }

  public boolean get(int bitNumber) {
    return nelmiscJNI.CBitSet_get(swigCPtr, this, bitNumber);
  }

  public void set(int bitNumber) {
    nelmiscJNI.CBitSet_set__SWIG_1(swigCPtr, this, bitNumber);
  }

  public void clear(int bitNumber) {
    nelmiscJNI.CBitSet_clear__SWIG_1(swigCPtr, this, bitNumber);
  }

  public void setAll() {
    nelmiscJNI.CBitSet_setAll(swigCPtr, this);
  }

  public void clearAll() {
    nelmiscJNI.CBitSet_clearAll(swigCPtr, this);
  }

  public void flip() {
    nelmiscJNI.CBitSet_flip(swigCPtr, this);
  }

  public boolean compareRestrict(CBitSet bs) {
    return nelmiscJNI.CBitSet_compareRestrict(swigCPtr, this, CBitSet.getCPtr(bs), bs);
  }

  public boolean isEqual(CBitSet bs) {
    return nelmiscJNI.CBitSet_isEqual(swigCPtr, this, CBitSet.getCPtr(bs), bs);
  }

  public boolean notEqual(CBitSet bs) {
    return nelmiscJNI.CBitSet_notEqual(swigCPtr, this, CBitSet.getCPtr(bs), bs);
  }

  public boolean allSet() {
    return nelmiscJNI.CBitSet_allSet(swigCPtr, this);
  }

  public boolean allCleared() {
    return nelmiscJNI.CBitSet_allCleared(swigCPtr, this);
  }

  public void serial(IStream f) {
    nelmiscJNI.CBitSet_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public SWIGTYPE_p_std__vectorT_unsigned_int_t getVector() {
    return new SWIGTYPE_p_std__vectorT_unsigned_int_t(nelmiscJNI.CBitSet_getVector(swigCPtr, this), false);
  }

  public void setUint(long srcValue, long i) {
    nelmiscJNI.CBitSet_setUint(swigCPtr, this, srcValue, i);
  }

  public String toString_c() {
    return nelmiscJNI.CBitSet_toString_c(swigCPtr, this);
  }

}
